package com.itfs.lesson2;

import org.springframework.boot.autoconfigure.batch.BatchProperties;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class TestInsert {
    public static void main(String[] args) {
        Connection conn = null;
        Statement st = null;
        ResultSet rs = null;

        try {
            conn = JdbcUtils.getConection();//获取数据库连接
            st = conn.createStatement();//获取SQL的执行对象
            String sql = "INSERT INTO users(id,NAME,PASSWORD,emali,birthday) VALUE(4,kuangsheng,123456@qq.com,2020-01-01)";
            int i = st.executeUpdate(sql);
            //执行SQL语句，返回数据行为1或者0；
            if (i>0){
                System.out.println("插入成功");
            }


        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }finally {
            //释放连接
            JdbcUtils.release(conn,st,rs);
        }
    }
}
